using System.Net.DnsToolkit.Packet;
namespace System.Net.DnsToolkit.Serializer {
    /// <summary>
    /// Read source object into question
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IQuestionReader<T> {

        /// <summary>
        /// Read source object into header throws exception if problem occurs
        /// </summary>
        /// <param name="source"></param>
        /// <returns>question to be read</returns>
        IQuestion Read(T source);

        /// <summary>
        /// Read source object into header. Do not throw exception.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="question"></param>
        /// <returns>true if no error occured, else false.</returns>
        bool TryRead(T source, out IQuestion question);
    }
}